import CrmRelative from '@/components/CreateCom/CrmRelative'

const injectedData = (otherObjComs) => {
// 处理 CrmRelative 相关
  const CrmRelativeData = otherObjComs['CrmRelative']
  if (CrmRelativeData) {
    // ***注入组件***
    const defaultComponents = CrmRelative.components || {}
    CrmRelative.components = {
      ...defaultComponents,
      ...CrmRelativeData.components
    }

    // ***注入data***
    const defaultData = CrmRelative.data()
    const dataKeys = ['defaultLeftItem', 'defaultTitle']
    dataKeys.forEach(key => {
      defaultData[key] = {
        ...defaultData[key],
        ...CrmRelativeData.data[key]
      }
    }
    )
    CrmRelative.data = function() {
      return defaultData
    }
  }
}

export default {
  injectedData
}
